"""
plot_wireframe
plot_surface
contour图
语谱图，时频分析，pcolormesh图
"""

import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits import mplot3d 
from matplotlib import cm # 三维绘图使用的颜色
print(dir(cm))

# 用来绘制各种二次曲面图，旋转双曲面的绘制方法，椭球面的绘制方法
fig = plt.figure()
ax = fig.add_subplot(1,1,1, projection = "3d")

# 绘图曲线一
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride = 1, cmap=cm.cividis, linewidth=50, antialiased=False)
# Add a color bar which maps values to colors.
fig.colorbar(surf, shrink=0.5, aspect=5)

# 绘图曲线二
# x = np.arange(-15, 15, 1)
# y = np.arange(-14, 12, 1)
# X, Y = np.meshgrid(x, y)
# Z = 75 - X**2 - Y**2 + X*Y
# ax.plot_surface(X, Y, Z)
# print(X.shape)
# print(X)
# print(Y)
# print(np.max(Z))


# 三维等高线图，用来分析梯度和方向导数
# fig, ax = plt.subplots()
# CS = ax.contour(X, Y, Z, levels=range(0, 75, 5))
# ax.clabel(CS, inline=True, fontsize=10)
# ax.set_title('Simplest default with labels')

plt.show()

